package com.lj.eduservice.entity.node;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author luojing
 * @version 1.0
 * @date 2021/5/6 13:41
 */
@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class SubjectNode {
    private String id;
    @JsonProperty(value = "label")
    private String title;
    @JsonProperty(value = "children")
    private List<SubjectNode> childrens = new ArrayList<>();

    public SubjectNode(String id,String title){
        this.id = id;
        this.title = title;
    }

    public void addChildren(SubjectNode childrenNode){
        childrens.add(childrenNode);
    }
}
